//
//  AddVideoView.swift
//  Venus
//
//  Created by qurongxiang on 2018/8/8.
//  Copyright © 2018年 zhaowang. All rights reserved.
//

import UIKit

class AddVideoView: UIView {
    
     lazy var btn = UIButton(type: .custom)
     lazy var progressView = UIProgressView()
     lazy var titleLabel = UILabel(UIColor.black ,17, "选择要上传的视频")
     lazy var infoLabel = UILabel(UIColor.init(hex: "999999")! ,17, "视频的时长不要超过15分钟")
     lazy var upBtn = UIButton(type: .custom)
     lazy var nameTextField = UITextField()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}

extension AddVideoView {
    
 
}

extension AddVideoView {
    func setupUI() {
        backgroundColor = UIColor.init(hex: "f4f6f8")
        
        let bgView = UIView()
        bgView.backgroundColor = UIColor.white
        addSubview(bgView)
        bgView.snp.makeConstraints { (make) in
            make.height.equalTo(200)
            make.left.top.equalToSuperview().offset(10)
            make.right.equalToSuperview().inset(10)
        }
        
        let bgBottomView = UIView()
        bgBottomView.backgroundColor = UIColor.white
        addSubview(bgBottomView)
        bgBottomView.snp.makeConstraints { (make) in
            make.height.equalTo(50)
            make.left.equalToSuperview().offset(10)
            make.right.equalToSuperview().inset(10)
            make.top.equalTo(bgView.snp.bottom).offset(10)
        }
        
        let bgBottomTitle = UILabel()
        bgBottomTitle.text = "追加标题"
        bgBottomTitle.textColor = UIColor.black
        bgBottomTitle.font = UIFont.systemFont(ofSize: 14)
        
        nameTextField.placeholder = "请输入标题"
        bgBottomView.addSubview(bgBottomTitle)
        bgBottomView.addSubview(nameTextField)
        nameTextField.font = UIFont.systemFont(ofSize: 14)
        
        bgBottomTitle.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(10)
            make.centerY.equalToSuperview()
        }
        
        nameTextField.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(83)
            make.right.equalToSuperview().inset(25)
            make.height.equalTo(35)
            make.centerY.equalToSuperview()
        }
        nameTextField.backgroundColor = UIColor.init(hex: "f4f6f8")
        nameTextField.fastCornerRadius(value: 17.5)
        let leftView = UIView()
        leftView.backgroundColor = UIColor.clear
        leftView.frame = CGRect(x: 0, y: 0, width: 30, height: 35)
        nameTextField.leftView = leftView
        nameTextField.leftViewMode = .always
        layoutIfNeeded()
        
        bgView.addSubview(progressView)
        progressView.snp.makeConstraints { (make) in
            make.left.top.right.equalToSuperview()
            make.height.equalTo(4)
        }
        progressView.backgroundColor = UIColor.blue
        progressView.progress = 0
        progressView.isHidden = true
        
        bgView.addSubview(upBtn)
        upBtn.setImage(UIImage(named: "VideoPlayGreen"), for: .normal)
        upBtn.snp.makeConstraints { (make) in
            make.size.equalTo(CGSize(width: 48, height: 48))
            make.centerX.equalToSuperview()
            make.centerY.equalToSuperview().offset(-30)
        }
    
        
        bgView.addSubview(titleLabel)
        bgView.addSubview(infoLabel)
        titleLabel.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.top.equalTo(upBtn.snp.bottom).offset(10)
        }
        
        infoLabel.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.top.equalTo(titleLabel.snp.bottom).offset(10)
        }
        
        
        addSubview(btn)
        btn.snp.makeConstraints { (make) in
            make.width.equalTo(250)
            make.height.equalTo(30)
            make.centerX.equalToSuperview()
            make.bottom.equalToSuperview().inset(80)
        }
        btn.setTitle("上 传", for: .normal)
        btn.backgroundColor = UIColor.init(hex: "17bbfe")
      
        btn.fastCornerRadius(value: 15)
    }
}
